package com.example.wx.dailyreport.javaconfig.mvcconverter;

import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;

@Component
public class StringToDateConverter implements Converter<String, LocalDateTime> {
    @Override
    public LocalDateTime convert(String source) {
        try {
            return LocalDateTime.parse(source);
        } catch (Exception e) {
            return null;
        }
    }
}
